gint i);
static void create_notebook_page_accessible (GailNotebook *gail_notebook,
GtkNotebook *notebook,
- GtkWidget *child);
+ GtkWidget *child,
+ int page_num);
static gboolean gail_notebook_focus_cb (GtkWidget *widget,
GtkDirectionType type);
static gboolean gail_notebook_check_focus_tab (gpointer data);
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (gtk_notebook));
notebook = GAIL_NOTEBOOK (atk_obj);
- create_notebook_page_accessible (notebook, gtk_notebook, child);
+ create_notebook_page_accessible (notebook, gtk_notebook, child, page_num);
}
static void
{
create_notebook_page_accessible (notebook,
gtk_notebook,
- gtk_notebook_get_nth_page (gtk_notebook, i));
+ gtk_notebook_get_nth_page (gtk_notebook, i),
+ i);
}
notebook->selected_page = gtk_notebook_get_current_page (gtk_notebook);
static void
create_notebook_page_accessible (GailNotebook *gail_notebook,
GtkNotebook *notebook,
- GtkWidget *child)
+ GtkWidget *child,
+ int page_num)
{
AtkObject *obj;
g_hash_table_insert (gail_notebook->pages,
child,
obj);
+ atk_object_set_parent (obj, ATK_OBJECT (gail_notebook));
+ g_signal_emit_by_name (gail_notebook, "children_changed::add", page_num, obj, NULL);
}
static gboolean
{
}
-static gint
-notify_child_added (gpointer data)
-{
- GailNotebookPage *page;
- AtkObject *atk_object, *atk_parent;
-
- g_return_val_if_fail (GAIL_IS_NOTEBOOK_PAGE (data), FALSE);
- page = GAIL_NOTEBOOK_PAGE (data);
- atk_object = ATK_OBJECT (data);
-
- page->notify_child_added_id = 0;
-
- /* The widget page->notebook may be deleted before this handler is called */
- if (page->notebook != NULL)
- {
- atk_parent = gtk_widget_get_accessible (GTK_WIDGET (page->notebook));
- atk_object_set_parent (atk_object, atk_parent);
- g_signal_emit_by_name (atk_parent,
- "children_changed::add",
- gtk_notebook_page_num (page->notebook, page->child),
- atk_object,
- NULL);
- }
-
- return FALSE;
-}
-
AtkObject*
gail_notebook_page_new (GailNotebook *notebook,
GtkWidget *child)
atk_object->role = ATK_ROLE_PAGE_TAB;
atk_object->layer = ATK_LAYER_WIDGET;
- page->notify_child_added_id = gdk_threads_add_idle (notify_child_added, atk_object);
/*
* We get notified of changes to the label
*/
if (page->textutil)
g_object_unref (page->textutil);
- if (page->notify_child_added_id)
- g_source_remove (page->notify_child_added_id);
-
G_OBJECT_CLASS (gail_notebook_page_parent_class)->finalize (object);
}